<div class="searchFrom" *ngIf="config">
  <form role="form" [formGroup]="searchFrom">
    <ul class="searchList clearfix">
      <li class="clearfix" *ngFor="let item of config" ngSwitch="{{item.type}}">
        <!--<label>{{item.label}}</label>-->
        <input *ngSwitchCase="'input'" pInputText [formControlName]="item.name" [placeholder]="item.placeholder">
        <p-dropdown *ngSwitchCase="'select'" [formControlName]="item.name" [options]="item.options"
                    [placeholder]="item.placeholder"></p-dropdown>
        <p-calendar *ngSwitchCase="'time'" [formControlName]="item.name" [showIcon]="true"
                    [placeholder]="item.placeholder" [locale]="ch" showButtonBar="true"></p-calendar>
      </li>
      <li class="searchBut">
        <button pButton label="重置" icon="fa fa-refresh" (click)="refresh()"></button>
        <button pButton label="搜索" icon="fa fa-search" (click)="search()"></button>
      </li>
    </ul>
  </form>
</div>
<p-dataTable [value]="values" [(selection)]="selected" [dataKey]="key"
             [paginator]="true" [rows]="pageSize" [(first)]="startIndex" [totalRecords]="totalNum"
             [loading]="loading" [rowHover]="true" [styleClass]="'styleClass'" [rowsPerPageOptions]="[5,10,20]"
             [lazy]="true" (onLazyLoad)="loadCarsLazy($event)" [emptyMessage]="'暂无数据'">
  <p-column *ngIf="multiple" [style]="{'width':'32px'}" selectionMode="multiple"></p-column>
  <p-column *ngFor="let column of columns" ngSwitch="{{column.type}}" header="{{column.header}}">
    <ng-template let-List="rowData" pTemplate="body" *ngSwitchDefault>
      {{ List[column.field] }}
    </ng-template>
    <ng-template let-List="rowData" pTemplate="body" *ngSwitchCase="'time'">
      {{ List[column.field] | myDate}}
    </ng-template>
    <ng-template let-List="rowData" pTemplate="body" *ngSwitchCase="'button'">
      <button class="tableBut" *ngFor="let button of List.buttons" (click)="butClick(button, List)">{{button.label}}
      </button>
    </ng-template>
  </p-column>
  <p-column header="操作" *ngIf="buttons">
    <ng-template let-List="rowData" pTemplate="body">
      <button class="tableBut" *ngFor="let button of buttons" (click)="butClick(button, List)">{{button.label}}</button>
    </ng-template>
  </p-column>

  <ng-template pTemplate="paginatorLeft">
    <!--共有{{data.length}}条，每页显示：10条-->
  </ng-template>
  <ng-template pTemplate="paginatorRight">
    共有{{values.length}}条，每页显示：10条
    <input class="goToPageInput" type="text" pInputText>
    <button class="goToPageBut" pButton label="GO" (click)="goToNewPage()"></button>
  </ng-template>
</p-dataTable>
